<template>
  <div>
    <h1>登录</h1>
    <table class="table table-bordered">
      <tbody>
        <tr>
          <td>账号</td>
          <td>
            <input type="text" v-model="info.uname" />
          </td>
        </tr>
        <tr>
          <td>密码</td>
          <td><input type="password" v-model="info.upwd" /></td>
        </tr>
        <tr>
          <td></td>
          <td><input type="button" value="登录" @click="login" /></td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script setup lang="ts">
import axios from "axios";
import { reactive } from "vue";
let info: any = reactive({
  uname: "",
  upwd: "",
});
const login = () => {
  axios({
    url: "/api/User/Login",
    method: "get",
    params: info,
  }).then((res) => {
    console.log(res);
    if (res.data == 1) {
      alert("账号不存在");
      return;
    }
    if (res.data == 2) {
      alert("密码错误");
      return;
    }
    if (res.data == 3) {
      alert("登录成功");
      return;
    }
  });
};
</script>

<style scoped></style>
